package beanstao.util.store.dal;

import beanstao.util.id.Id;
import beanstao.util.log.ILog;
import beanstao.util.log.LogHelper;
import beanstao.util.store.dal.interfaces.IDomainCreate;
import beanstao.util.store.dal.interfaces.IDomainDelete;
import beanstao.util.store.dal.interfaces.IDomainRemove;
import beanstao.util.store.domainobject.Domain;


public abstract class Dal<T extends Domain> implements ILog, IDomainCreate<T>, IDomainDelete<T>, IDomainRemove<T>
{
	/**
	 * 创建一个空实体
	 * 
	 * @return
	 */
	public abstract T newBlankDomain();

	/**
	 * 创建一个实体
	 * 
	 * @param modifiorId 创建该实体的用户的ID
	 * @return
	 */
	public abstract T newDomain(Id modifiorId);

	/**
	 * 创建一个实体
	 * 
	 * @param modifiorId 创建该实体的用户的ID
	 * @param newDomainId 赋给该实体一个指定的ID
	 * @return
	 */
	public abstract T newDomain(Id modifiorId, Id newDomainId);

	@Override
	public void logDebug(Object message)
	{
		LogHelper.logDebug(this, message);
	}

	@Override
	public void logDebug(Object message, Throwable t)
	{
		LogHelper.logDebug(this, message, t);
	}

	@Override
	public void logError(Object message)
	{
		LogHelper.logError(this, message);
	}

	@Override
	public void logError(Object message, Throwable t)
	{
		LogHelper.logError(this, message, t);
	}

	@Override
	public void logInfo(Object message)
	{
		LogHelper.logInfo(this, message);
	}

	@Override
	public void logInfo(Object message, Throwable t)
	{
		LogHelper.logInfo(this, message, t);
	}

	@Override
	public void logWarn(Object message)
	{
		LogHelper.logWarn(this, message);
	}

	@Override
	public void logWarn(Object message, Throwable t)
	{
		LogHelper.logWarn(this, message, t);
	}

}
